<template>
	<!-- 商品列表 -->
	<div id="product-list">
	  <div id="top">
	    <img src="../../assets/logo.png">
	    <span>主页</span><span>></span><span>评估鉴定</span>
	    <input type="button" value="刷新" id="flush-button" />
	  </div>
	  <div id="mid">
	        <div style="width: 10%;float: left;margin-left: 20px;">
	          <span style="line-height: 60px;margin-left: 10px;">筛选查询</span>
			  
	        </div>
	        <div class="top">
	          <el-input placeholder="请输入商品名称" v-model="goodPageParameter.goodsName" style="width: 150px"></el-input>
	          <el-date-picker type="date" placeholder="选择开始日期" value-format="yyyy-MM-dd" v-model="goodPageParameter.minTime">
	          </el-date-picker>
	          <el-date-picker type="date" placeholder="选择结束日期" value-format="yyyy-MM-dd" v-model="goodPageParameter.maxTime">
	          </el-date-picker>
	          <el-select placeholder="请选择状态" v-model="goodPageParameter.goodsVendibility" :clearable="true">
	          	<el-option v-for="item in status" :key="item.value" :label="item.label" :value="item.value">
	          	</el-option>
	          </el-select> 
	          <el-select v-model="goodPageParameter.userId" placeholder="请选择创建人" :clearable="true">
	          	</el-option>
	          </el-select>
	          <el-button type="primary" @click="loaDate()">查询</el-button>
	        </div>
			<div id="mid-centre-right-text">
			  <span>数据列表</span>
			</div>
			<div id="btn-all">
				<!--<input type="button" value="新增" class="sousrb" @click="dialogFormVisible = true" />
					<input type="button" value="修改" @click="updatebtn()" class="sousrb"  />
					<input type="button" value="删除" @click="deleteGoods()" class="sousrb" /> -->
			  <el-button type="success" @click="inserGoodFormVisible=true">新增商品</el-button>
			  <el-button type="danger" plain :disabled="isShow" @click="deleteGoods">删除</el-button>
			  <el-button type="success" @click="updateGoodFormVisible=true">修改</el-button>
			  <el-button type="success" @click="estimateGoodFormVisible=true">评估</el-button>
			  <el-button type="success" plain @click="evaluationFormVisible=true">鉴定</el-button>
			</div>
			<!-- 新增商品 -->
			<el-dialog title="新增商品" :visible.sync="inserGoodFormVisible">
			  <el-form label-width="250px" :model="insertGood">
			    <el-form-item label="商品名称">
			      <el-input v-model="insertGood.goodsName" size="medium" autocomplete="off"></el-input>
			    </el-form-item>
				<el-form-item label="商品编号">
				  <el-input v-model="insertGood.goodsNumber" autocomplete="off"></el-input>
				</el-form-item>
			    <el-form-item label="商品品牌">
			      <el-select v-model="insertGood.brandName" placeholder="请选择商品品牌">
			        <el-option v-for="item in brandList" :key="item.brandId" :label="item.brandName"
			          :value="item.brandName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="商品货号">
			      <el-input v-model="insertGood.goodsArticleNumber" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="库存状态">
			      <el-select v-model="insertGood.goodsStatus" placeholder="请选择仓库状态">
			        <el-option v-for="item in goodsStatus" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="商品来源">
			      <el-select v-model="insertGood.goodsStore" placeholder="请选择商品来源" autocomplete="off">
			        <el-option v-for="(item,index) in sourceTypeList" :key="item.storeId" :label="item.storeName"
			          :value="item.storeName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="是否处于流程中">
			      <el-select v-model="insertGood.goodsProcedure" placeholder="是否处于流程中" autocomplete="off">
			        <el-option v-for="item in goodsProcedure" :key="item.value" :label="item.label" :value="item.value">
			        </el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="大类">
			      <el-select v-model="insertGood.primaryCategoryName" autocomplete="off">
			        <el-option v-for="(item,index) in primaryCategoryList" :key="item.primaryCategoryId" :label="item.primaryCategoryName"
			          :value="item.primaryCategoryName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="小类">
				  <el-select v-model="insertGood.subclassName" autocomplete="off">
				    <el-option v-for="(item,index) in subclassNameList" :key="item.subclassId" :label="item.subclassName"
				      :value="item.subclassName"></el-option>
				  </el-select>
			    </el-form-item>
			    <el-form-item label="客户首买价">
			      <el-input v-model="insertGood.goodsFirstPrice" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="是否可租">
			      <el-select v-model="insertGood.goodsRent" autocomplete="off">
			        <el-option label="是" value="1"></el-option>
			        <el-option label="否" value="0"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="是否可售">
			      <el-select v-model="insertGood.goodsVendibility" autocomplete="off">
			        <el-option label="是" value="1"></el-option>
			        <el-option label="否" value="0"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="寄卖最低价">
			      <el-input v-model="insertGood.goodsMinPrice" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="商品图片">
			      <el-upload 
				    class="upload-demo" 
					action="http://localhost/primary-category/upload"
					name="file"
					multiple :limit="4"
			        :on-preview="handlePreview"
			        :on-remove="handleRemove"
					:on-success="fileSuccess"
					:file-list="fileList">
			        <el-button size="small" type="primary">上传商品图片</el-button>
			      </el-upload>
			    </el-form-item>
			    <el-form-item label="商品描述">
			      <el-input type="textarea" v-model="insertGood.goodsDescribe" size="medium"
			        style="width: 300px;margin-left: 10px;"></el-input>
			    </el-form-item>
			  </el-form>
			  <div slot="footer" class="dialog-footer">
			    <el-button @click="inserGoodFormVisible = false">取 消</el-button>
			    <el-button type="primary" @click="addGood">确 定</el-button>
			  </div>
			</el-dialog>
			
			<!-- 修改商品 -->
			<el-dialog title="修改商品" :visible.sync="updateGoodFormVisible">
			  <el-form label-width="250px" :model="isUpdateGood">
			    <el-form-item label="商品名称">
			      <el-input v-model="isUpdateGood.goodsName" size="medium" autocomplete="off"></el-input>
			    </el-form-item>
				<el-form-item label="商品编号">
				  <el-input v-model="isUpdateGood.goodsNumber" autocomplete="off"></el-input>
				</el-form-item>
			    <el-form-item label="商品品牌">
			      <el-select v-model="isUpdateGood.brandName" placeholder="请选择商品品牌">
			        <el-option v-for="item in brandList" :key="item.brandId" :label="item.brandName"
			          :value="item.brandName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="商品货号">
			      <el-input v-model="isUpdateGood.goodsArticleNumber" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="库存状态">
			      <el-select v-model="isUpdateGood.goodsStatus" placeholder="请选择仓库状态">
			        <el-option v-for="item in goodsStatus" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="商品来源">
			      <el-select v-model="isUpdateGood.goodsStore" placeholder="请选择商品来源" autocomplete="off">
			        <el-option v-for="(item,index) in sourceTypeList" :key="item.storeId" :label="item.storeName"
			          :value="item.storeName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="是否处于流程中">
			      <el-select v-model="isUpdateGood.goodsProcedure" placeholder="是否处于流程中" autocomplete="off">
			        <el-option v-for="item in goodsProcedure" :key="item.value" :label="item.label" :value="item.value">
			        </el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="大类">
			      <el-select v-model="isUpdateGood.primaryCategoryName" autocomplete="off">
			        <el-option v-for="(item,index) in primaryCategoryList" :key="item.primaryCategoryId" :label="item.primaryCategoryName"
			          :value="item.primaryCategoryName"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="小类">
				  <el-select v-model="isUpdateGood.subclassName" autocomplete="off">
				    <el-option v-for="(item,index) in subclassNameList" :key="item.subclassId" :label="item.subclassName"
				      :value="item.subclassName"></el-option>
				  </el-select>
			    </el-form-item>
			    <el-form-item label="客户首买价">
			      <el-input v-model="isUpdateGood.goodsFirstPrice" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="是否可租">
			      <el-select v-model="isUpdateGood.goodsRent" autocomplete="off">
			        <el-option label="是" value="1"></el-option>
			        <el-option label="否" value="0"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="是否可售">
			      <el-select v-model="isUpdateGood.goodsVendibility" autocomplete="off">
			        <el-option label="是" value="1"></el-option>
			        <el-option label="否" value="0"></el-option>
			      </el-select>
			    </el-form-item>
			    <el-form-item label="寄卖最低价">
			      <el-input v-model="isUpdateGood.goodsMinPrice" autocomplete="off"></el-input>
			    </el-form-item>
			    <el-form-item label="商品图片">
			      <el-upload 
				    class="upload-demo" 
					action="http://localhost/primary-category/upload"
					name="goodsIcon"
					multiple :limit="4"
			        :on-preview="handlePreview"
			        :on-remove="handleRemove"
					:file-list="fileList">
			        <el-button size="small" type="primary">上传商品图片</el-button>
			      </el-upload>
			    </el-form-item>
			    <el-form-item label="商品描述">
			      <el-input type="textarea" v-model="isUpdateGood.goodsDescribe" size="medium"
			        style="width: 300px;margin-left: 10px;"></el-input>
			    </el-form-item>
			  </el-form>
			  <div slot="footer" class="dialog-footer">
			    <el-button @click="updateGoodFormVisible = false">取 消</el-button>
			    <el-button type="primary" @click="updateGood">确 定</el-button>
			  </div>
			</el-dialog>
			
			<!-- 鉴定商品div -->
			<el-dialog title="鉴定商品" :visible.sync="evaluationFormVisible">
			  <el-form label-width="250px">
			    <el-form-item label="商品编号">
			      <el-input v-model="backAppraisal.goodsId" size="medium" :disabled="true"></el-input>
			    </el-form-item>
				<el-form-item label="商品名">
				  <el-input v-model="backAppraisal.goodsName" size="medium" :disabled="true"></el-input>
				</el-form-item>
			    <el-form-item label="商品分类">
			      <el-input v-model="backAppraisal.primaryCategoryName" size="medium" :disabled="true"></el-input>
			    </el-form-item>
			    <el-form-item label="商品图片">
			      <el-image v-for="item in imageList" :key="item.value" style="width: 100px; height: 100px" :src="item" :name="123">
			      </el-image>
			    </el-form-item>
			    <el-form-item label="新旧程度">
					<el-select v-model="backAppraisal.degreeId" placeholder="新旧程度" autocomplete="off">
					  <el-option v-for="item in degreeStatus" :key="item.value" :label="item.label" :value="item.value">
					  </el-option>
					</el-select>
			    </el-form-item>
			    <el-form-item label="鉴定">
					<el-select v-model="backAppraisal.appraisalResult" placeholder="鉴定真假" autocomplete="off">
					  <el-option v-for="item in appraisalResultStatus" :key="item.value" :label="item.label" :value="item.value">
					  </el-option>
					</el-select>
			       <el-button style="float: right;" @click="identifyLogVisible=true">鉴定历史记录</el-button>
			    </el-form-item>
			    <el-dialog title="鉴定历史" :visible.sync="identifyLogVisible">
			      <el-table :data="identifyLog" style="width: 80%">
			        <el-table-column prop="appraisalId" label="序号" width="180">
			        </el-table-column>
			        <el-table-column prop="appraisalResult" :formatter="appraisalResultformatterStatus" label="结果" width="180">
			        </el-table-column>
			        <el-table-column prop="degreeId" :formatter="degreeIdformatterStatus" label="新旧程度">
			        </el-table-column>
			        <el-table-column prop="userName" label="鉴定人">
			        </el-table-column>
			        <el-table-column prop="appraisalTime" label="鉴定时间" :formatter="formatterAppraisaltime">
			        </el-table-column>
			      </el-table>
			    </el-dialog>
			    <el-form-item label="备注">
			      <el-input type="textarea" v-model="backAppraisal.appraisalRemarks" size="medium"
			        style="width: 300px;margin-left: 10px;" />
			    </el-form-item>
			  </el-form>
			  <div slot="footer" class="dialog-footer">
			    <el-button @click="evaluationFormVisible = false">取 消</el-button>
			    <el-button type="primary" @click="appraisalGoods">确 定</el-button>
			  </div>
			  </el-dialog>
			  
			  <!-- 评估商品 -->
			  <el-dialog title="评估商品" :visible.sync="estimateGoodFormVisible">
			    <el-form label-width="250px">
			      <el-form-item label="商品编号">
			        <el-input v-model="bckList.goodsId" size="medium" :disabled="true"></el-input>
			      </el-form-item>
				  <el-form-item label="商品名">
				    <el-input v-model="bckList.goodsName" size="medium" :disabled="true"></el-input>
				  </el-form-item>
				  <el-form-item label="官方价">
				    <el-input v-model="bckList.evaluationOfficialPrice" size="medium"></el-input>
				  </el-form-item>
				  <el-form-item label="评估价">
				    <el-input v-model="bckList.evaluationPrice" size="medium"></el-input>
				  </el-form-item>
				  <el-form-item label="典当价">
				    <el-input v-model="bckList.evaluationPawnPrice" size="medium"></el-input>
				  </el-form-item>
				  <el-form-item label="收购价">
				    <el-input v-model="bckList.evaluationPurchasingPrice" size="medium"></el-input>
				  </el-form-item>
				  <el-form-item label="售卖价">
				    <el-input v-model="bckList.evaluationSalePrice" size="medium" ></el-input>
				  </el-form-item>
				  <el-form-item label="租价">
				    <el-input v-model="bckList.evaluationRental" size="medium" ></el-input>
				  </el-form-item>
				  
			      <el-form-item label="商品图片">
			        <el-image v-for="item in imageList" :key="item.value" style="width: 100px; height: 100px" :src="item" :name="123">
			        </el-image>
			      </el-form-item>
			      <el-form-item label="评估记录">
			         <el-button  @click="appraisalFormVisible=true">评估历史记录</el-button>
			      </el-form-item>
			      <el-dialog title="评估历史" :visible.sync="appraisalFormVisible">
			        <el-table :data="estimateLog" style="width: 80%">
			          <el-table-column prop="evaluationId" label="序号" width="180">
			          </el-table-column>
					  <el-table-column prop="goodsName" label="商品">
					  </el-table-column>
			          <el-table-column prop="evaluationOfficialPrice" label="官方价">
			          </el-table-column>
					  <el-table-column prop="evaluationPrice" label="评估价">
					  </el-table-column>
					  <el-table-column prop="evaluationTime" label="评估时间" :formatter="formatterEvaluationTime">
					  </el-table-column>
					  <el-table-column prop="userName" label="评估人">
					  </el-table-column>
					  <el-table-column prop="evaluationRemarks" label="备注">
					  </el-table-column>
			        </el-table>
			      </el-dialog>
			      <el-form-item label="备注">
			        <el-input type="textarea" v-model="bckList.evaluationRemarks" size="medium"
			          style="width: 300px;margin-left: 10px;" />
			      </el-form-item>
			    </el-form>
			    <div slot="footer" class="dialog-footer">
			      <el-button @click="estimateGoodFormVisible = false">取 消</el-button>
			      <el-button type="primary" @click="addEstimate">确 定</el-button>
			    </div>
			</el-dialog>
			
			
		<div id="div-good">
		  <el-table :data="tableData" ref="goods-list" @selection-change="rowChange" @select="backList" stripestyle="width: 100%;" :stripe="true" :border="true">
		    <el-table-column type="selection" width="60" align="center"></el-table-column>
		    <el-table-column prop="goodsId" label="编号" width="63" align="center"></el-table-column>
		    <el-table-column prop="goodsName" label="商品名称" width="240" align="center"></el-table-column>
		    <el-table-column prop="primaryCategoryName" label="分类" width="150" align="center"> </el-table-column>
		    <el-table-column prop="goodsEnterName" label="录入人" width="100" align="center"> </el-table-column>
		    <el-table-column prop="goodsAppraisalName" label="鉴定人" width="100" align="center"> </el-table-column>
		    <el-table-column prop="goodsEvaluator" label="评估人" width="100" align="center"> </el-table-column>
		    <el-table-column prop="goodsEnterTime" label="录入时间" width="300" align="center" :formatter="formatterStarttime"></el-table-column>
		    <el-table-column prop="goodsVendibility" label="状态" width="100" :formatter="formatterStatus" align="center"> </el-table-column>
		  </el-table>
		  <!-- 分页按钮 -->
		</div>
		<el-pagination @current-change="changePage" background layout="prev, pager, next"
		  :total="total" :current-page="page.indexPage"
		  :page-size="page.pageSize"
		  style="float: right;margin-right: 25px;">
		</el-pagination>
	  </div>
	</div>
</template>

<script>
	export default{
		name:"Goods",
		data(){
			return{
				imageList: [
					"https://longsc.oss-cn-chengdu.aliyuncs.com/10/1634540396648.png",
					"https://longsc.oss-cn-chengdu.aliyuncs.com/10/1634543336875.jpg",
					"https://longsc.oss-cn-chengdu.aliyuncs.com/10/1634543403780.png"
					],
				fileList:[],
				creatName:[],
				tableData:[],//查询商品渲染到页面
				goodPageParameter: {//条件查询
				  goodsName: null,
				  goodsVendibility:null,
				  userId:null,
				  userName: null,
				  minTime: null,
				  maxTime: null
				},
				//点击指定商品鉴定回写数据
				backAppraisal:{
					goodsName:null,
					primaryCategoryName:null,
					goodsNumber:null,
					appraisalId:null,
					goodsId:null,
					userName:null,
					degreeId:null,
					appraisalRemarks:null,
					appraisalResult:null
					
				},
				//点击指定商品评估回写数据
				bckList:{
					goodsName:null,
					goodsId:null,
					evaluationId:null,
					userName:null,
					evaluationOfficialPrice:null,//官方价
					evaluationPawnPrice:null,//典当价
					evaluationPurchasingPrice:null,//收购价
					evaluationSalePrice:null,//售卖价
					evaluationRental:null,//租价
					evaluationRemarks:null,//备注
					evaluationPrice:null//评估价
				},
				
				goodsStatus:[//库存状态
					{value:0,label:"有货"},
					{value:1,label:"无货"}
				],
				degreeStatus:[
					{value:0,label:"五成新"},
					{value:1,label:"六成新"},
					{value:2,label:"七成新"},
					{value:3,label:"八成新"},
					{value:4,label:"九成新"}
				],
				appraisalResultStatus:[
					{value:0,label:"真货"},
					{value:1,label:"假货"},
					{value:2,label:"差资料"}
				],
				goodsProcedure:[//流程状态
					{value:0,label:"流程中"},
					{value:1,label:"不在流程中"}
				],
				evaluationFormVisible:false,//鉴定商品弹出框
				isShow:false,
				selects:[],//选中删除
				identifyLog: [],//存鉴定记录信息
				estimateLog:[],//存评估记录信息
				brandList: [],//商品品牌
				sourceTypeList:[],//查询门店
				primaryCategoryList:[],//查询大类
				subclassNameList:[],//查询商品小类
				
				//添加商品参数
				insertGood: {
				  // goodsName:null,
				  // goodsId:null,
				  // primaryCategoryName:null,
				  // userName:null,
				  // degreeId:null,
				  // appraisalRemarks:null,
				  // appraisalResult:null,
				  
				  
				  goodsId:null,
				  goodsName:null,
				  goodsNumber:null,
				  brandName:null,
				  goodsArticleNumber:null,
				  goodsStatus:null,
				  goodsStore:null,
				  goodsProcedure:null,
				  primaryCategoryName:null,
				  subclassName:null,
				  goodsFirstPrice:null,
				  goodsRent:null,
				  goodsVendibility:null,
				  goodsMinPrice:null,
				  goodsDescribe:null,
				  goodsIcon:null,
				  goodsCreateTime:null
				},
				isUpdateGood: {
				  goodsId:null,
				  goodsName:null,
				  goodsNumber:null,
				  brandName:null,
				  goodsArticleNumber:null,
				  goodsStatus:null,
				  goodsStore:null,
				  goodsProcedure:null,
				  primaryCategoryName:null,
				  subclassName:null,
				  goodsFirstPrice:null,
				  goodsRent:null,
				  goodsVendibility:null,
				  goodsMinPrice:null,
				  goodsDescribe:null,
				  goodsIcon:null
				},
				
				//鉴定商品
				isIdentifyGood: {
				  appraisalId:null,//商品id
				  goodsId:null,//商品名称
				  userId: null,//鉴定人id
				  userName: null,//鉴定人名字
				  degreeId: null,//新旧程度
				  appraisalRemarks: null,//备注
				  appraisalResult: null,//鉴定结果，真，假，资料不全
				  appraisalTime: null,//鉴定时间
				  primaryCategoryName: null,//商品大类
				  goodsFirstPrice: null//商品首卖价
				},
				page:{//分页参数
					indexPage:1,
					pageSize:3
				},
				total:0,//总页数
				status:[//状态
					{value:0,label:"待鉴定"},
					{value:1,label:"已鉴定"},
					{value:2,label:"待评估"},
					{value:3,label:"已评估"}
				],
				evaluationFormVisible:false,//鉴定商品弹出框
				dialogTableVisible: false,
				inserGoodFormVisible: false, //新增表单是否显示
				updateGoodFormVisible: false, //修改表单是否显示
				identifyGoodFormVisible: false, //鉴定表单是否显示
				identifyLogVisible: false, //鉴定历史是否显示
				estimateGoodFormVisible: false,//评估界面是否显示
				appraisalFormVisible:false//评估历史是否显示
			}
		},
		  created() {
		       this.showGoods();
			   this.loaDate();
			   this.selectBrand();
			   this.selectStore();
			   this.selectPrimaryCategory();
			   this.selectSubclassCategory();
			   this.selectIdentifyLog();
			   this.selectEstimateLog();
		  },
		methods:{
			fileSuccess(response,file,fileList){
				console.log(response);
				this.imageList=response.data;
			},
			updateGood(){
				console.log(this.isUpdateGood)
				this.$http.put("/goods/updateGoods",
				this.isUpdateGood
				).then(resp=>{
					if(resp.data.code==705){
						alert("修改成功");
						this.updateGoodFormVisible=false;
					}else{
						alert("修改失败");
					}
					}).catch(function(error){
					  console.log(error);
				})
			},
			//添加评估信息
			addEstimate(){
				this.bckList.goodsId = this.selects[0];
				this.$http.post("/goods-evaluation/addEvaluation",
				this.bckList
				).then(resp=>{
					if(resp.data.code==707){
						alert("评估成功");
						this.estimateGoodFormVisible=false;
						this.selectEstimateLog();
						this.showGoods();
					}else{
						alert("评估失败");
					}
					}).catch(function(error){
					  console.log(error);
				})
			},
			//分页查询评估历史
			selectEstimateLog(){
				this.$http.get("/goods-evaluation/queryEvaluation",{
					params:this.page,
					}).then(resp=>{
						this.estimateLog=resp.data.data.evaluationDtoList;
						this.total=resp.data.data.pageSize;
						this.page.indexPage=resp.data.data.indexSize;
					}).catch(function(error){
					    alert(error);
				})
			},
			//分页查询鉴定历史
			selectIdentifyLog(){
				this.$http.get("/goods-appraisal/queryAppraisal",{
					params:this.page,
					}).then(resp=>{
						this.identifyLog=resp.data.data.appraisalDtoList;
						this.total=resp.data.data.pageSize;
						this.page.indexPage=resp.data.data.indexSize;
					}).catch(function(error){
					    alert(error);
				})
			},
			//鉴定商品（添加）
			appraisalGoods(){
				this.backAppraisal.goodsId = this.selects[0];
				//this.appraisalTime.goodsCreateTime=this.datolong(this.appraisalTime.goodsCreateTime);
				this.$http.post("/goods-appraisal/addGoodsAppraisal",
				this.backAppraisal
				).then(resp=>{
					if(resp.data.code==707){
						alert("添加成功");
						this.evaluationFormVisible=false;
						this.selectIdentifyLog();
						this.showGoods();
					}else{
						alert("添加失败");
					}
					}).catch(function(error){
					  console.log(error);
				})
			},
			//鉴定返回已有商品信息
			backList(crteList,row){
				//console.log(crteList)
				this.isUpdateGood=crteList;
				this.isUpdateGood={};
				this.bckList={};
				this.backAppraisal={};
				if(crteList.length>0){
					this.backAppraisal.goodsId=crteList[0].goodsId;
					this.backAppraisal.primaryCategoryName=crteList[0].primaryCategoryName;
					this.backAppraisal.goodsName=crteList[0].goodsName;
					this.bckList.goodsId=crteList[0].goodsId;
					this.bckList.goodsName=crteList[0].goodsName;
					this.isUpdateGood=crteList[0];
				}
			},
			//判断鉴定返回已有商品信息
			modifyCategory() {
				if(this.backAppraisal == null | this.backAppraisal == '' | this.oneModel.goodsId == null | this.oneModel.goodsId == '') {
					alert("请选择一项")
				}else {
					this.evaluationFormVisible = true;
				}
			},
			//字符串转时间
			datolong(s){
				var d = new Date(s).getTime();
				return d;
			},
			//分页查询全部
			showGoods() {
			this.$http.get("/goods/goodsQuery",{
							params:this.page,
							}).then((resp)=>{
					this.tableData=resp.data.data.goodsDtoList;
					console.log('-------------------')
					console.log(this.tableData)
					this.total=resp.data.data.pageSize;
					this.page.indexPage=resp.data.data.indexPage;
				}).catch(function(error){
					alert(error);
				})
			},
			formatterStarttime(row){//录入时间
				  return new Date(row.goodsEnterTime).toLocaleDateString();
			},
			formatterAppraisaltime(row){
				  return new Date(row.appraisalTime).toLocaleDateString();
			},
			formatterEvaluationTime(row){
				  return new Date(row.evaluationTime).toLocaleDateString();
			},
			//添加商品
			addGood(){
				this.page.indexPage=1;
				this.showGoods();
				this.insertGood.goodsCreateTime=this.datolong(this.insertGood.goodsCreateTime);
				console.log(this.insertGood)
				//this.addMyLeave.starttime=this.datolong(this.addMyLeave.starttime);
				//this.addMyLeave.endtime=this.datolong(this.addMyLeave.endtime);
				this.$http.post("/goods/addGoods",this.insertGood).then(resp=>{
					     console.log(resp.data.data);
						if(resp.data.code==707){
							alert("添加成功");
							this.fileList=[];
							this.insertGood=resp.data.data;
							this.inserGoodFormVisible = false;
							this.showGoods();
						}else{
							alert("添加失败");
						}
					}).catch(function(error){
						console.log(error);
				})
			},
			//图片上传
			handleRemove(file, fileList) {
				console.log(file, fileList);
			},
			handlePreview(file) {
				console.log(file);
			},
			//状态下拉表
			formatterStatus(row){
				if(row.goodsVendibility==0) return "待鉴定/待评估";
					else if(row.goodsVendibility==1) return "已鉴定";
					else if(row.goodsVendibility==2) return "已评估";
		    },
			degreeIdformatterStatus(row){
				if(row.degreeId==0) return "五成新";
					else if(row.degreeId==1) return "六成新";
					else if(row.degreeId==2) return "七成新";
					else if(row.degreeId==2) return "八成新";
					else if(row.degreeId==2) return "九成新";
			},
			appraisalResultformatterStatus(row){
				if(row.appraisalResult==0) return "真货";
					else if(row.appraisalResult==1) return "假货";
					else if(row.appraisalResult==2) return "差资料";
			},
			//条件查询
			loaDate() {
			this.$http.post("/goods/goodsBuyQuery",{
							goodsPageParam:this.page,
							goodsQueryByCriteriaParam:this.goodPageParameter
							}).then((resp)=>{
					this.tableData=resp.data.data.goodsDtoList;
					this.total=resp.data.data.pageSize;
					this.page.indexPage=resp.data.data.indexPage;
				}).catch(function(error){
					alert(error);
				})
			},
			//页面跳转
			changePage(index){   
			   this.page.indexPage=index;
			   this.showGoods();
			},
			//时间转换
			datolong(s){
				var d = new Date(s).getTime();
				return d;
			},
			rowChange(sel){
				this.selects=[];
				for(var i=0;i<sel.length; i++){
					this.selects.push(sel[i].goodsId)
				}
			},
			//删除商品
			deleteGoods(){
				this.$http.post("/goods/deleteGoods",{
					idsList:this.selects
				}).then((resp)=>{
					if(resp.data.code==703){
						this.$message({
							message:'删除成功',
							type:'success'
						})
						this.page.indexPage=1;
						this.showGoods();
					}else{
						this.$message({
							message:'删除失败',
							type:'success',
						})	
					}
				})
			},
			selectBrand(){
				this.$http.get("/goods-brand/brandInquiry").then(resp=>{
					this.brandList=resp.data.data.brandDtoList;
				})
			},
			selectStore(){
				this.$http.get("/goods/selectStoryName").then(resp=>{
					this.sourceTypeList=resp.data.data.selectStoryNameListDtos;
				})
			},
			selectPrimaryCategory(){
				this.$http.get("/goods/selectCategoryName").then(resp=>{
					this.primaryCategoryList=resp.data.data.selectCategoryNameListDtos;
				})
			},
			selectSubclassCategory(){
				this.$http.get("/goods/selectSubclassName").then(resp=>{
					this.subclassNameList=resp.data.data.selectSubclassNameListDtos;
				})
			}
		}
	}
</script>

<style>
	#btn-all input {
	  border: none;
	  background-color: rgba(102, 102, 102, 1);
	  color: white;
	  width: 70px;
	  height: 30px;
	  cursor: pointer;
	  margin-top: 5px;
	  margin-right: 20px;
	  float: right;
	}
	
	
	.el-input__inner {
	  width: 300px !important;
	  margin-top: 0px !important;
	  margin-left: 10px !important;
	  float: left !important;
	}
	
	#div-good {
	  background-color: #E6E6E6;
	  height: auto;
	  margin-left: 30px;
	  width: 95%;
	}
	
	#mid-centre-right-text {
	  float: left;
	  width: 35%;
	  height: 40px;
	  line-height: 40px;
	  font-size: 14px;
	  margin-left: 30px;
	}
	
	#mid-centre-row1 {
	  background-color: #E6E6E6;
	  height: 40px;
	  margin-top: 10px;
	  margin-left: 30px;
	  width: 95%;
	  /* border: #E6E6E6 2px solid; */
	}
	
	#mid-centre-left {
	  border-right: 2px #D8D8D8 solid;
	  float: left;
	  width: 5%;
	  height: 100%;
	}
	
	#select-btn input {
	  border: none;
	  background-color: rgba(102, 102, 102, 1);
	  color: white;
	  width: 70px;
	  height: 30px;
	  cursor: pointer;
	  margin-top: 15px;
	  margin-right: 10px;
	  float: right;
	}
	
	#mmid-centre-left img {
	  width: 30px;
	  height: 30px;
	  margin-top: 15px;
	  margin-left: 20px;
	}
	
	#mid-centre {
	  width: 100%;
	}
	
	#div-mindata {
	  line-height: 60px;
	  float: left;
	  width: 14%;
	  margin-left: 5px;
	}
	
	#div-classify {
	  line-height: 60px;
	  float: left;
	  width: 11%;
	}
	
	#div-dim {
	  line-height: 60px;
	  float: left;
	  width: 11%;
	}
	
	#div-division {
	  line-height: 60px;
	  float: left;
	  width: 2%;
	  text-align: center;
	}
	
	#div-input {
	  line-height: 60px;
	  float: left;
	  margin-left: 50px;
	  width: 6%;
	}
	
	#div-operator {
	  line-height: 60px;
	  float: left;
	  margin-left: 30px;
	  width: 10%;
	}
	
	#sta-select {
	  line-height: 60px;
	  float: left;
	  border: none;
	}
	
	#mid-up-right {
	  float: left;
	  height: 100%;
	  width: 94%;
	  font-size: 14px;
	  color: #666666;
	}
	
	#mid-up-left {
	  border-right: 2px #D8D8D8 solid;
	  float: left;
	  width: 5%;
	  height: 100%;
	}
	
	#mid-up-left img {
	  width: 30px;
	  height: 30px;
	  margin-top: 15px;
	  margin-left: 20px;
	}
	
	#mid-up {
	  background-color: #E6E6E6;
	  height: 60px;
	  margin-top: 15px;
	  margin-left: 30px;
	  width: 95%;
	}
	
	#context {
	  width: 1200px;
	}
	
	#top {
	  width: 95%;
	  background-color: white;
	  height: 40px;
	  line-height: 40px;
	  font-size: 12px;
	}
	
	#top span {
	  margin-left: 10px;
	}
	
	#top img {
	  margin-top: 10px;
	  margin-left: 10px;
	  width: 15px;
	  height: 15px;
	}
	
	#flush-button {
	  float: right;
	  margin-right: 55px;
	  margin-top: 4px;
	  width: 70px;
	  height: 30px;
	  border: none;
	  background-color: rgba(102, 102, 102, 1);
	  color: white;
	  cursor: pointer;
	}
	
	#mid {
	  width: 95%;
	  background-color: #D8D8D8;
	  height: 700px;
	  overflow: hidden;
	}
	
	.el-input__prefix,
	.el-input__suffix {
	  height: auto !important;
	}
	
	.goodimg:hover {
	  transform: scale(3);
	  z-index: 999;
	}
	
	.main>div{
		margin-top: 20px;
	}
	.top> *{
		margin-right: 30px;
		width: 200px;
	}
</style>

